#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
'''
Created on 20/08/2013

@author: Jesper Hertel
'''
import os
import locale
import gettext
import sys

_submoduleListForVersioning = []
import versioning; _revisionInfo = versioning.getRevisionInfoFromTagsAndSubModules('$Revision$', '$Date$', _submoduleListForVersioning)


def setLanguage():
    # Set the LANGUAGE environment variable if running under Windows,
    # for gettext.
    if os.name == 'nt': # We are running under Microsoft Windows.
        lang = locale.getdefaultlocale()[0]
        os.environ['LANGUAGE'] = lang

def installTranslation():
    '''
    Make the gettext translation of strings ready.
    '''
    setLanguage()
    DIRECTORY_WITH_TRANSLATED_MESSAGES = os.path.join(os.path.dirname(sys.argv[0]), 'messages')
    gettext.install('gmail-backup', DIRECTORY_WITH_TRANSLATED_MESSAGES, unicode=True)
